//
//  CyclePictureTCell.swift
//  MikerShoppingApp
//
//  Created by eme on 2016/10/20.
//  Copyright © 2016年 eme. All rights reserved.
//

import UIKit
import RxSwift
import UtilCore
/*
 owner:cy
 update:2017年03月27日10:28:11
 info: 平台分类 section的cell
 VC :  HomePageVc
 */

class Ptfl_Section_CCell: UICollectionViewCell {


    @IBOutlet weak var ptfl_Buttons_Cv: UICollectionView!
    var buttons:[AnyObject]?{
        didSet{
            self.ptfl_Buttons_Cv.reloadData()
        }
    }
    
    
}
// MARK: - UICollectionViewDataSource
extension Ptfl_Section_CCell:UICollectionViewDataSource{
    func numberOfSections(in collectionView: UICollectionView) -> Int{
        return 1
    }
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int{
        return self.buttons?.count ?? 0
    }
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell{
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Ptfl_Row_CCell", for: indexPath) as!Ptfl_Row_CCell
        cell.item = self.buttons?[indexPath.row]
        return cell
    }
}
extension Ptfl_Section_CCell:UICollectionViewDelegate{
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath){
        
    }
}

extension Ptfl_Section_CCell:UICollectionViewDelegateFlowLayout{
    
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize{
        
        return Ptfl_Row_CCell.cellSize
        
    }
    
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets{
        return Ptfl_Row_CCell.cellEdgeInsets
    }
    
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat{
        
        return 0
    }
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat{
        return Ptfl_Row_CCell.interitemSpacing
    }
}
